<?php
/**
 * This file was used when I was testing how the INITIALIZE_PATH stage of initialization
 * was being routed. 
 * 
 * The only test in this file is url_test, which just displays URL and path data
 */

$main = 'test';

/**
 * test()
 * 
 * @return void
 */
function test()
{
	global $test;
	
	$function = $test . '_test';
	if (function_exists($function))
	{
		$retVal = $function($msg);
	}
	
	system_add_styles('assets/css/tests.css');
	
	//print(render_page(($retVal ? '<div class="test passed"><p><strong>PASSED:</strong> ' : '<div class="test failed"><p><strong>FAILED:</strong>') . ' <code>' . $function . '</code> <br /><div class="message"><strong>Message:</strong> <br />' . $msg . '</div></p></div>', 'Unit Tests'));
	print(($retVal ? '<div class="test passed"><p><strong>PASSED:</strong> ' : '<div class="test failed"><p><strong>FAILED:</strong>') . ' <code>' . $function . '</code> <br /><div class="message"><strong>Message:</strong> <br />' . $msg . '</div></p></div>');
}

/**
 * url_test()
 * 
 * @param mixed $msg
 * @return
 */
function url_test(&$msg)
{
	global $q, $base_url;
	
	$request = $_SERVER['REQUEST_URI'];
	$path_info = pathinfo($request);
	$msg .= debug($path_info);
	$msg .= '----------------------------<br />';
	$msg .= '$q = ' . $q;
	$msg .= '<br />----------------------------<br />';
	$msg .= '$_SERVER[\'QUERY_STRING\'] = ' . $_SERVER['QUERY_STRING'];
	$msg .= '<br />----------------------------<br />';
	$msg .= '$base_url = ' . $base_url;
	
	return FALSE;
}
